#ifndef __DYNAMICARRAY_H_
#define __DYNAMICARRAY_H_
#include <stdbool.h>

#define ElementType void*
#define INITDARRAY(a) DArray a;MyInitDynamicArray(&a);

struct DynamicArray;
typedef struct DynamicArray DArray;

struct DynamicArray
{
    ElementType *dp; //动态数组指针
    int size;   //容量
    int len;    //长度


    bool (*MyInsertArrayTail)(DArray *a,ElementType element);
    bool (*MyRemoveByElement)(DArray *a,ElementType element,bool (*funcPtr)(ElementType,ElementType),void (*ClearPtr)(ElementType));
    DArray (*MyFindElement)(DArray *a,ElementType element,bool (*funcPtr)(ElementType,ElementType));
    void (*MyDisplayDynamicArray)(DArray *a,void (*funcPtr)(ElementType));
    void (*MySort)(DArray *a,bool (*funcPtr)(ElementType,ElementType));
    void (*MyClearDynamicArray)(DArray *a,void (*funcPtr)(ElementType));
};


void MyInitDynamicArray(DArray *a);


#endif